<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title><spring:message code="tianjiashouhuodizhi"></spring:message></title>
    <link href="${pageContext.request.contextPath }/phone/css/font/iconfont.css" rel="stylesheet" type="text/css" />
    <!--公共样式-->
    <link href="${pageContext.request.contextPath }/phone/css/public.css" rel="stylesheet" type="text/css" />
    <!--layer弹出-->
    <link href="${pageContext.request.contextPath }/phone/js/layer/skin/layer.css" rel="stylesheet" type="text/css" />
    <!--我的(个人中心)样式-->
    <link href="${pageContext.request.contextPath }/phone/css/mine.css" rel="stylesheet" type="text/css" />

</head>
<body>
<!--头部 begin-->
<header class="page_topbar">
    <a href="javascript:history.go(-1);" class="back Hui-iconfont"></a>
    <div class="title"><spring:message code="tianjiashouhuodizhi"></spring:message></div>
</header>
<!--头部 end-->
 <form id="address" action="${pageContext.request.contextPath }/api/address/insertaddress">
<div class="content mb-80">

    <ul class="minelist pt-10">
        <li class="bt-1"><div class="minelistleft"><spring:message code="reciveAddress.goodsReceiptPerson"></spring:message>:</div><input name="aName" datatype="s2-30"  nullmsg="<spring:message code='qingtianxiexinxi'></spring:message>" errormsg="<spring:message code='qingshurumingcheng'></spring:message>" class="minelistinput" type="text" /><div class="clearf"></div></li>
        <li><div class="minelistleft"><spring:message code="reciveAddress.mobilePhoneNumber1"></spring:message>:</div><input class="minelistinput" type="text" name="aPhone" datatype="m" nullmsg="<spring:message code='qingtianxiexinxi'></spring:message>" errormsg="<spring:message code='qingshuruzhengqueshoujihao'></spring:message>" /><div class="clearf"></div></li>
        <li class="location-btn"><div class="minelistleft"><spring:message code="reciveAddress.localArea"></spring:message>:</div><input name="aAddress" readonly="readonly" datatype="*" nullmsg="<spring:message code='qingxuanze'></spring:message>" id="addressthis" class="minelistinput" type="text" /><i class="Hui-iconfont">&#xe63d;</i><div class="clearf"></div></li>
        <li><div class="minelistleft"><spring:message code="reciveAddress.detailedAddress1"></spring:message>:</div><input name="aAddressInfo" datatype="*" nullmsg="<spring:message code='qingtianxiexinxi'></spring:message>" placeholder="<spring:message code="reciveAddress.pleaseEnterDetailedAddress"></spring:message>" class="minelistinput" type="text" /><div class="clearf"></div></li>
        <li><div class="minelistleft"><spring:message code="reciveAddress.zipCode"></spring:message>:</div><input name="aCode" datatype="p" nullmsg="<spring:message code='qingtianxiexinxi'></spring:message>" errormsg="<spring:message code='qingshuruzhengqueyoubian'></spring:message>" class="minelistinput" type="text" /><div class="clearf"></div></li>
    </ul>
</div>
<div class="bottomaddress">
    <div class="block-auto"><button class="end-next" type="submit" ><spring:message code="reciveAddress.save"></spring:message></button></div>
</div>
</form>
<div class="conceal"></div>
<!--修改所在地提示信息-->
<div class="messagemox location">
    <div class="headli">
        <i class="Hui-iconfont">&#xe6a6;</i>
       <spring:message code="xuanzesuozaidi"></spring:message>
    </div>
    <div class="content">
        <select name="province"></select><select name="city"></select><br>
    </div>
    <div class="bottom">
        <input type="button" value="<spring:message code="queren"></spring:message>" class="btnn addressok">
        <input type="button" value="<spring:message code="quxiao"></spring:message>" class="btnn noOk">
    </div>
</div>
<script src="${pageContext.request.contextPath }/phone/js/jquery-1.8.3.min.js"></script>
<!--提示信息-->
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/layer/layer_mobile/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/h-ui/lib/Validform/5.3.2/Validform.min.js"></script>

<!-- 弹出框 -->
<script type="text/javascript" src="${pageContext.request.contextPath }/phone/js/window.js"></script>
<c:if test="${language=='en'}">
<!-- 修改所在地选择地区 -->
<script language="javascript" src="${pageContext.request.contextPath }/phone/js/PCASClass.js"></script>
</c:if>
<c:if test="${language=='zh_cn'}">
<!-- 修改所在地选择地区 -->
<script language="javascript" src="${pageContext.request.contextPath }/phone/js/PCASClass.js"></script>
</c:if>
<!-- 选择所在地 -->
<script language="javascript">
    new PCAS("province", "city");
    $(function(){
    	$.Tipmsg.r=null;
    	var showmsg=function(msg){
    		if(msg=="正在提交数据…"){
    			return;
    		}
    		 layer.open({content: msg,skin: 'msg',time: 1});
	   	   		

    	}
    	$("#address").Validform({
    		ajaxPost:true,
    		tiptype:function(msg){
    			showmsg(msg);
    		},
    		tipSweep:true,
    		callback:function(result){
    			 var status=result.msg.status;
    			 var desc=result.msg.desc;
    			 if(status == 0){
    				 layer.open({content: '<spring:message code="baocunchenggong"></spring:message>',skin: 'msg',time: 1});
 		   	   		
    				location.href="${pageContext.request.contextPath }/api/address/addresslist";
    			 }else if(status == 3){//只能添加3条记录
    				 layer.open({content: '<spring:message code="zhinengtianjia3tiaojilu"></spring:message>',skin: 'msg',time: 1});
 		   	   		
    			 }else if(status == 2){//没登录
    				 layer.open({content: '<spring:message code="weidenglu"></spring:message>',skin: 'msg',time: 1});
 		   	   		
    			    }else if(status ==1){//失败
    			    	layer.open({content: '<spring:message code="caozuoshibai"></spring:message>',skin: 'msg',time: 1});
    			    }
    			 }
    	});
    	 //选择所在地确定按钮事件
        $(".addressok").click(function () {
            var adprovince =$("select[name='province']").find("option:selected").text();
            var adcity =$("select[name='city']").find("option:selected").text();
            var addressthis = adprovince+"-"+adcity;
            if(adprovince == "--请选择省份--"){
                layer.open({content: "请选择地址",skin: 'msg',time: 1});;
                return false;
            }else{
                $("#addressthis").val(addressthis);
                $(".messagemox").css("display", "none");
                $(".conceal").hide();
            }
        });
    });
 
</script>
</body>

</html>